import bgAnimation from './bgAnimation' // 登录界面背景图动画
import modal from './modal' // 自定义全局模态框

import weather from './environmentSummary/weather' //天气
import environment from './environmentSummary/environment' // 当前环境
import growthModel from './environmentSummary/growthModel' // 生长模型
import waterConsumption from './environmentSummary/waterConsumption' // 灌溉水量
import fertilizer from './environmentSummary/fertilizer' // 施肥占比
// import equipment from './environmentSummary/equipment' // 设备信息
import device from './environmentSummary/device' // 设备信息


// 环境组件
import amTemp from './environmentSummary/environment/amTemp'
import temp from './environmentSummary/environment/temp'
import co2 from './environmentSummary/environment/co2'
import humidity from './environmentSummary/environment/humidity'
import lightIntensity from './environmentSummary/environment/lightIntensity'
import ph from './environmentSummary/environment/ph'

// 设备组件
import totalNum from './environmentSummary/device/totalNum'
import onlineNum from './environmentSummary/device/onlineNum'
import offlineNum from './environmentSummary/device/offlineNum'
import alarNum from './environmentSummary/device/alarNum'

const components = {
  bgAnimation,
  modal,

  weather,
  environment,
  growthModel,
  waterConsumption,
  fertilizer,
  // equipment,
  device,

  amTemp,
  temp,
  co2,
  humidity,
  lightIntensity,
  ph,

  totalNum,
  onlineNum,
  offlineNum,
  alarNum
};

const install = (Vue = {}) => {
  if (install.installed) return;
  Object.keys(components).forEach(component => {
    Vue.component(components[component].name, components[component]);
  });

  install.installed = true;
};

install.installed = false;

if (typeof window !== "undefined" && window.Vue) {
  install(window.Vue);
  install.installed = true;
}

const Vcomp = {
  ...components,
  install
};


export default Vcomp
